 <?php  
    $companyid=$session->read("companyid");
    $user=$session->read('User');
    $isflag=$action->checkPermissions($user,"confirm");
    if($showpage==1) {
        if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 	
    }	
?>
<div class="right_side_operate_area">
    <div class="right_side_title left">
        <h2>
            <?php 
            $companyname=$session->read("companyname");
            echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
            ?>
        </h2>
        <div class="clear"></div>
    </div>
    <?php
        if(empty($companyeco_year)&&classregistry::init('User')->personAuthority($user)){
            echo '<div class="right item_add_btn">';
            echo $html->link(__('添加',true),'editeconomic');
            echo '</div>';
            }else{
            echo '<div class="right enableaction">';
            echo "<a>添加</a>";
            echo '</div>';
        }
    ?>
    <div class="clear"></div>
    <div class="right_sidt_head_screen">
    <div class="right display_by_year_btn" style="display:none"><?php echo $html->link('按年度显示',"/companys/timeeconomics/".$company["Company"]["id"],null,null); ?></div>
        <div class="clear"></div>
    </div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
            <b>单位：<font >万元</font></b>
            <table>
                <tr>
                    <th>年月</th>
                    <th>总收入</th>
                    <th>净利润</th>
                    <th>工业总产值</th>
                    <th>产品销售额</th>
                    <th>利税</th>
                    <th>上缴税金</th>
                    <th>出口创汇</th>
                    <th>减免税指标</th>
                    <th>高企减免税</th>
                    <th>研发费减免税</th>
                    <th>审核状态</th>
                    <th><?php __('Action'); ?></th>				
                    <th>&nbsp;</th>
                </tr>
            <?php 
                if(!empty($comp_economics)){
                    foreach ($comp_economics as $comp_economic)
                    {
                        $id=$comp_economic["CompEconomic"]["id"];
                        $state=$comp_economic["CompEconomic"]["state"];
                        $creater=$comp_economic["CompEconomic"]["creater"];
                        echo "<tr class='per_list'>";
                        $year=$comp_economic['CompEconomic']['company_year'];
                        $month=$comp_economic['CompEconomic']['month'];
                        echo "<td>".$html->link($year.'年'.$month.'月',"/companys/showeconomic/".$id,null,null)."</td>";
                        
                        $columnlist=array("general_income","net_profit","prospect","gross_output",
									"pro_taxe","over_taxes","qcll","taxindex","tax","devtax");
						foreach ($columnlist as $column){
							echo "<td>";
							$columnvalue=$comp_economic["CompEconomic"][$column];
							if(!$state){	
								echo $this->element('changevalue',array('value'=>$columnvalue,'db'=>'CompEconomic','id'=>$id,'columnname'=>$column));
							}else{
								echo $str->formatquantity($columnvalue);
							}
							echo "</td>";
						}		
						echo "<td>".$str->getflag($comp_economic['CompEconomic']['state'])."</td>";
						
                        echo "<td>";
                        if((empty($user['cid']) || $user['cid']==null)&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($comp_economic)){
                            echo $html->link(__('Edit',true),"/companys/editeconomic/".$id);
                            if($state=="1"){ 
                            if(($creater==$user['id'])||($isflag)){
                            echo $html->link(__('Delete',true),"/companys/deleconomics/".$id,array("onclick"=>"return doaction(this)"));
                            }else{
                            echo "<span class='enableaction'>删除</span>";
                                }
                            }else{
                            echo $html->link(__('Delete',true),"/companys/deleconomics/".$id,array("onclick"=>"return doaction(this)"));
                            }
                        }else{
                            if(($comp_economic['CompEconomic']['state']=='2' || $comp_economic['CompEconomic']['state']=='')&&classregistry::init('User')->personAuthority($user)){
                                echo $html->link(__('Edit',true),"/companys/editeconomic/".$id);
                                echo $html->link(__('Delete',true),"/companys/deleconomics/".$id,array("onclick"=>"return doaction(this)"));
                            }else{
                            	echo "<span class='enableaction'>编辑</span>";
                            	 echo "<span class='enableaction'>删除</span>";
                            }
                            
                        }
                        
                        
                        echo "</td>";																	
                        echo "</tr>";
                    }
                }
            ?>
            </table>
        </div>
    </div>
</div>

<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>







